﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Xml.Linq;

namespace Formsy.Config
{
    /// <summary>
    /// TODO: why the hell did we write this class???...for god sake move these hardcoded strings into a resource or settings file or something!
    /// </summary>
    public sealed class ControlType
    {
        public static string Div = "div";
        public static string H3 = "h3";
        public static string Label = "label";
        public static string FieldSet = "fieldSet";
        public static string Link = "link";
        public static string Span = "span";
        

        #region Input controls
        
        public static string Button = "Button";
        public static string TextBox = "TextBox";
        public static string CheckBox = "CheckBox";
        public static string DropDownList = "DropDownList";
        public static string RadioButton = "RadioButton";
        public static string TextArea = "TextArea";
        public static string HiddenField = "HiddenField";
        public static string CheckBoxList = "CheckBoxList";
        public static string RadioButtonList = "RadioButtonList";
        public static string FileUpload = "FileUpload";
        public static string DatePicker = "DatePicker";
        public static string PasswordField = "PasswordField";
        public static string PasswordPair = "PasswordPair";
        public static string Literal = "Literal";
        public static string CustomField = "CustomField";

        public static string EmailPair = "EmailPair";

        #endregion        
        
    
        #region validator types
        public static string ValidationSummary = "ValidationSummary";
        public static string CompareValidator = "CompareValidator";
        public static string RangeValidator = "RangeValidator";
        public static string RequiredFieldValidator = "RequiredFieldValidator";
        public static string RegularExpressionValidator = "RegularExpressionValidator";
        public static string CustomValidator = "CustomValidator";
        
        #endregion



        public static bool CanServerValidate(string inputType)
        {
            if (inputType == CheckBox || inputType == RadioButton || inputType == CheckBoxList)
                return false;
            else 
                return true;
        }


        /// <summary>
        /// Returns true if field is any of : PasswordPair, FileUpload, DatePicker, Literal, CustomField.
        /// </summary>
        /// <param name="field"></param>
        /// <returns></returns>
        public static bool IsNonStandardField(string fieldType)
        {
            if (fieldType == PasswordPair
                || fieldType == FileUpload
                || fieldType == DatePicker
                || fieldType == Literal
                || fieldType == CustomField
                || fieldType == EmailPair)
                return true;
            return false;
        }
    }



}
